package com.gph.saviorframework.dao.security;

import com.gph.saviorframework.base.dao.BaseDao;
import com.gph.saviorframework.common.model.Position;
import org.apache.ibatis.annotations.Param;
import org.aspectj.lang.annotation.Aspect;

import java.util.List;
import java.util.Map;

@Aspect
public interface PositionDao extends BaseDao<Position,String> {

    /**
     * 查询结果集
     * @param sort
     * @param dir
     * @param whereClause
     * @return
     */
    List<Map<String,Object>> find(@Param(value = "sort") String sort, @Param(value = "dir") String dir,
                                  @Param(value = "where_clause") String whereClause);


    /**
     * 返回结果集数量
     * @param whereClause
     * @return
     */
    long count(@Param(value = "where_clause") String whereClause);

    List<Map<String,Object>> findByOrg(@Param(value = "orgId") String orgId, @Param(value = "plId") String plId);

    /**
     * 添加岗位和部门的关系
     */
    void addPositionRelOrg(@Param(value = "positionId") String positionId,
                           @Param(value = "orgId") String orgId);

    /**
     * 删除岗位和部门的关系
     * @param positionId
     */
    void deletePositionRelOrg(@Param(value = "positionId") String positionId);

    /**
     * 添加岗位和岗位级别之间的关系
     * @param positionId
     * @param plId
     */
    void addPositionRelPositionLevel(@Param(value = "positionId") String positionId,
                                     @Param(value = "plId") String plId);

    void deletePositionRelPositionLevel(@Param(value = "positionId") String positionId);

    void addPositionRelRole(@Param(value = "positionId") String positionId,
                            @Param(value = "roleId") String roleId);

    /**
     * 删除岗位和角色之间的关系
     * @param positionId
     */
    void deletePositionRelRole(@Param(value = "positionId") String positionId);

    /**
     * 获取主键（最大值+1）
     * @return
     */
    String getKey();
}
